package com.hss.recyclerviewtest.behavior;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.CoordinatorLayout;
import android.support.design.widget.SwipeDismissBehavior;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MotionEvent;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.support.v7.widget.CardView;
import android.widget.Toast;

import com.github.siyamed.shapeimageview.CircularImageView;
import com.hss.recyclerviewtest.R;

public class BehaviorActivity extends AppCompatActivity {
    TextView tv_child;

    Button btn_observed;
//    @Override
//    protected void onCreate(@Nullable Bundle savedInstanceState) {
//        super.onCreate(savedInstanceState);
//        setContentView(R.layout.activity_behavior);
//        tv_child = findViewById(R.id.tv_child);
//        btn_observed = findViewById(R.id.btn_observed);
//        btn_observed.setOnTouchListener(new View.OnTouchListener() {
//            @Override
//            public boolean onTouch(View v, MotionEvent event) {
//
//                switch (event.getAction()){
//
//                    case MotionEvent.ACTION_MOVE:
//                        v.setX(event.getRawX()-v.getWidth()/2);
//                        v.setY(event.getRawY()-v.getHeight()/2);
//                        break;
//                }
//                return  false;
//            }
//        });
//    }



    CircularImageView civ_head;
    Toolbar main_toolbar;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_behavior2);
        civ_head = findViewById(R.id.civ_head);


        //SwipeDismissBehavior
//        CardView mCardView = findViewById(R.id.card);
//        final SwipeDismissBehavior<CardView> swipe
//                = new SwipeDismissBehavior();
//        swipe.setSwipeDirection(
//                SwipeDismissBehavior.SWIPE_DIRECTION_ANY);
//        swipe.setListener( new SwipeDismissBehavior.OnDismissListener() {
//            @Override public void onDismiss(View view) {
//                Toast.makeText(BehaviorActivity.this, "Card swiped !!", Toast.LENGTH_SHORT).show();
//            }
//
//             @Override public void onDragStateChanged(int state) {
//
//             }
//        });
//        CoordinatorLayout.LayoutParams coordinatorParams = (CoordinatorLayout.LayoutParams) mCardView.getLayoutParams();
//        coordinatorParams.setBehavior(swipe);


        main_toolbar = findViewById(R.id.toolbar);
        main_toolbar.inflateMenu(R.menu.main_menu);
        main_toolbar.setTitle("");
//        setSupportActionBar(main_toolbar);
    }




}
